#!/usr/bin/env bash
# Git Hook for ban on push to master branch

changedBranch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# Add blocked user username
blockedUsers=(junior1 junior2)

if [[ ${blockedUsers[*]} =~ $USER ]]; then
    if [ "$changedBranch" == "master" ]; then
        echo "You are not allowed commit changes in this branch"
        exit 1
    fi
fi
